import React from 'react';
import { Table, Icon } from 'antd';

let List = React.createClass({
    getDetail(params){
        
        this.props.getDetail(params);
    },
    handleTableChange(pagination){
    
        const pager = this.props.pagination;
        pager.current = pagination.current;
        pager.currentPage = pagination.current;
       
        this.props.getPagination('3',pager)
    },
    rowKey(data){
        return data.tenementId;
    },
    render() {
        const columns = [
            {
                title: '房源地址',
                dataIndex: 'address',
                key: 'address',
            },
            {
                title: '房东',
                dataIndex: 'userRealName',
                key: 'userRealName',
            },
            
            {
                title: '租约期限',
                dataIndex: 'contractPeriod',
                key: 'contractPeriod',
                render: (text) => <span>{text}个月</span>,
            },
            {
                title: '租约起租时间',
                dataIndex: 'startTime',
                key: 'startTime',
            },
            
            // {
            //     title: '更多',
            //     dataIndex: 'more',
            //     key: 'more',
            //     render: (text,record) => {
            //         let params = {
            //             rentContractId: record.rentContractId,                        
            //         }
            //         return (
            //             <a href="javascript:;" onClick={this.getDetail.bind(this, params )}>详情</a>
            //         )
            //     }
            // },
            
        ];
        console.log(this.props.dataList)
        return (

            <Table rowKey={this.rowKey} 
            columns={columns} 
            dataSource={this.props.dataList}
            pagination={this.props.pagination}
            onChange={this.handleTableChange} />
        )
    }
});

export default List